import { createRouter, createWebHistory } from "vue-router";

import RegisterView from "@/views/register/index.vue";
import LoginView from "@/views/login/index.vue";
import HomeView from "@/views/home/index.vue";
import ShouView from "@/views/home/home.vue";
import FenView from '@/views/home/fen.vue'
import ShopView from '@/views/home/shop.vue'
import MyView from '@/views/home/my.vue'
import SearchView from '@/views/search/index.vue'
import DetailView from '@/views/detail/index.vue'
import GoodsView from '@/views/goods/index.vue'
import OrderView from '@/views/order/index.vue'
import MyorderView from '@/views/myorder/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path:'/',redirect:'/home/home'},
    {
      path: "/register",
      component: RegisterView,
    },
    {
      path: "/login",
      component: LoginView,
    },
    {
      path: "/search",
      component: SearchView,
    },
    {
      path: "/detail/:goods_id",
      component: DetailView,
    },
    {
      path: "/goods/:cat_id",
      component: GoodsView,
    },
    {
      path: "/order/:orderId",
      component: OrderView,
    },
    {
      path: "/myorder",
      component: MyorderView,
    },
    {
      path: "/home",
      component: HomeView,
      children: [
        {
          path: "home",
          component: ShouView,
        },
        {
          path: "fen",
          component: FenView,
        },
        {
          path: "shop",
          component: ShopView,
        },
        {
          path: "my",
          component: MyView,
        },
      ],
    },
  ],
});

export default router;
